home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_c / ansippv2 / ansi.dat next >
Text File  |  1987-09-29  |  1KB  |  56 lines

  1. #define x    3
  2. #define f(a)    f(x * (a))
  3. #undef x
  4. #define x    2
  5. #define g    f
  6. #define z    z[0]
  7. #define h    g(~
  8. #define m(a)    a(w)
  9. #define w    0,1
  10. #define t(a)    a
  11.  
  12. f(y+1) + f(f(z)) % t(t(g)(0) + t)(1);
  13. g(2+(3,4)-w) | h 5) & m
  14.       (f)^m(m);
  15.  
  16. #undef f
  17. #undef x
  18. #undef x
  19. #undef g
  20. #undef z
  21. #undef h
  22. #undef m
  23. #undef w
  24. #undef t
  25.  
  26. #define str(s)        # s
  27. #define xstr(s)        str(s)
  28. #define debug(s, t)    printf("x" #s "= %d, x" #t "= %s", \
  29.                 x ## s, x ## t)
  30. #define INCFILE(n)    vers ## n
  31. #define glue(a, b)    a ## b
  32. #define xglue(a, b)    glue(a, b)
  33. #define HIGHLOW        "hello"
  34. #define LOW        LOW ", world"
  35.  
  36. debug(1, 2);
  37. fputs(str(strncmp("abc\0d", "abc", '\4') /* this goes away */
  38.       == 0) str(: @\n), s);
  39. #include xstr(INCFILE(2).h)
  40. glue(HIGH, LOW)
  41. xglue(HIGH, LOW)
  42.  
  43. #define OBJ_LIKE    (1-1)
  44. #define OBJ_LIKE    /* white space */ (1-1) /* other */
  45. #define FTN_LIKE(a)    ( a )
  46. #define FTN_LIKE( a )(        /* note the white space */ \
  47.               a /* other stuff on this line
  48.                 */ )
  49.  
  50. Invalid macro redefinitions follow.
  51.  
  52. #define OBJ_LIKE    (0)    /* different token sequence */
  53. #define OBJ_LIKE    (1 - 1)    /* different white space */
  54. #define FTN_LIKE(b)    ( a )    /* different parameter usage */
  55. #define FTN_LIKE(b)    ( b )    /* different parameter spelling */
  56.